home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0081_Getting Disk Type.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-25  |  1KB  |  50 lines

  1. {
  2. MR│ How do you tell the difference between a fixed hard drive, and a
  3.   │ removable drive or network drive?  Why? I have a program which reports
  4.  
  5. This little demo program contains the answers for most of your
  6. questions.
  7.  
  8.  
  9. { uses int $21, service $44, subservices 8 & 9  to get drive
  10.   existence, removeable/non-removeable, and local/remote status }
  11.  
  12. uses dos;
  13.  
  14. var drive   : word;
  15.     ts      : string[30];
  16.     r       : registers;
  17.     drexist : boolean;
  18.  
  19. begin
  20.       for drive := 1 to 26 do
  21.         begin
  22.           drexist := false;
  23.           ts := 'unkn';
  24.  
  25.           r.ax := $4408;      { check for dos floppy/hard drv }
  26.           r.bl := drive;
  27.           msdos(r);
  28.           if not odd(r.flags) then   { if not carry then ... }
  29.             begin
  30.               drexist := true;
  31.               if (r.ax = 0) then ts := 'floppy' else ts := 'hard';
  32.             end;
  33.  
  34.           r.ax := $4409;      { check for local/remote (lan) drv }
  35.           r.bl := drive;
  36.           msdos(r);
  37.           if not odd(r.flags) then
  38.             begin
  39.               drexist := true;
  40.               if ((r.dh and $10) <> 0) then ts := 'remote';
  41.             end;
  42.  
  43.           If DrExist then
  44.             begin
  45.               ts := chr(ord('A')+pred(drive))+':   ' + ts;
  46.               writeln(ts);
  47.             end;
  48.         end;
  49. end.
  50.